import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { SpecService } from './spec.service';
import {
  Controller,
  Get,
  Query,
  UseInterceptors,
  ClassSerializerInterceptor,
} from '@nestjs/common';

@ApiTags('图片规格')
@Controller('spec')
export class SpecController {
  constructor(private readonly SpecService: SpecService) {}
  @ApiOperation({ description: '获取图片规格' })
  @Get('getList')
  @UseInterceptors(ClassSerializerInterceptor)
  async getList(@Query('id') id: number) {
    try {
      return await this.SpecService.getList(id);
    } catch (e) {
      return Promise.reject(e);
    }
  }
}
